<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<%@page import="avicit.platform6.core.locale.PlatformLocalesJSTL"%>
<%@page import="java.util.Locale"%>
<%@page import="avicit.platform6.api.session.SessionHelper"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ page import="avicit.platform6.commons.utils.ViewUtil"%>
<%@ taglib prefix="sec" uri="/WEB-INF/tags/shiro.tld"%>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>设置模版列数</title>
<base href="<%=ViewUtil.getRequestPath(request)%>">

<%@page import="avicit.platform6.api.sysshirolog.impl.AfterLoginSessionProcess"%>
<%
	Object lang = session
			.getAttribute(AfterLoginSessionProcess.SESSION_CURRENT_LANGUAGE_CODE);
	String languageCode = "zh_CN";
	if (lang != null) {
		languageCode = lang.toString();
	}
	Locale locale = SessionHelper.getLocaleByUser(request);
%>
<%
	String dialogId = request.getParameter("dialogId");
	String nodeId = request.getParameter("nodeId");
	String tableId = request.getParameter("tableId");
%>
<jsp:include
	page="/avicit/platform6/component/common/EasyUIJsInclude.jsp"></jsp:include>
<jsp:include page="/avicit/im/common/ImUIJSCSSInclude.jsp"></jsp:include>
<link href="static/css/custom/lantop/css/custom.css" type="text/css"  rel="stylesheet">
<script type="text/javascript"
	src="avicit/cbb/techclass/billdefine/locale/language_<%=languageCode%>.js"></script>
<script type="text/javascript">

$(function() {
	dialogId = "<%=dialogId%>";
	nodeId = "<%=nodeId%>";
	tableId = "<%=tableId%>";
	initForm();
});

	function initForm(){
		$
		.ajax({
			url : 'platform/cbb/billDefineManagerController/getModelColumn',
			data : {
				nodeId : nodeId,
				tableId : tableId
			},
			type : 'post',
			dataType : 'json',
			success : function(result) {
				var columnNum = result.columnNum;
				if(columnNum != null && columnNum != "" && columnNum != "null"){
					$("#columnNum").combobox("setValue", result.columnNum);
				}
			}
		});
	}
	
	function saveForm() {
		var columnNum = $("#columnNum").combobox("getValue");
		if(columnNum == ""){
			//'提示','请选择模板列数！'
			$.messager.alert(commonLang.tip.alert,commonLang.optip.content5,'warning');
			return false;
		}
		// 访问controller保存值
		$
					.ajax({
						url : 'platform/cbb/billDefineManagerController/setModelColumn',
						data : {
							nodeId : nodeId,
							tableId : tableId,
							columnNum : columnNum
						},
						type : 'post',
						dataType : 'json',
						success : function(result) {
							// 成功后提示，关闭页面
							if(result.flag == "success"){
								parent.$.messager.show({
									title:'提示',
									//'设置成功！'
									msg:commonLang.optip.content6,
									timeout:2000,
									showType:'slide'
								});
								closeForm();
							}else{
								$.messager.show({
									title:'提示',
									//'设置失败！'
									msg:commonLang.optip.content7,
									timeout:2000,
									showType:'slide'
								});
							}
						}
					});
	}

	function closeForm() {
		 if (parent != null && parent.$('#' + dialogId) != null) {
		        parent.$('#' + dialogId).dialog('close'); //关闭当前窗口
		    }
	}
	window.onresize = comboboxHidePanel;
</script>
</head>
<body class="easyui-layout" fit="true">
	<div data-options="region:'center',split:true,border:false">
		<form id='form'>
			<input type="hidden" name="id" />
			<table class="table_init" style="margin:25px auto;">
				<tr>
					<%-- 模板列数 --%>
					<td width="25%"><span class="remind" style="color:red;">*</span><%=PlatformLocalesJSTL
					.getBundleValue(
							"lantop.basicdatamanager.formManager.table.button.setTemplateColumnNum.templateColumnNum",
							"i18n.lantop", locale)%></td>
					<td><input id="columnNum" class="easyui-combobox"
						data-options="editable:false,required:true,valueField: 'value',textField: 'label',data: [{label: '一列',value: '1'},{label: '两列',value: '2'},{label: '三列',value: '3'},{label: '四列',value: '4'}],panelHeight:'auto',onShowPanel:comboboxOnShowPanel" />
					</td>
				</tr>
			</table>
		</form>
	</div>
	<div data-options="region:'south',border:false">
		<div id="toolbar"
			style="border:none;">
			<table class="tableForm" border="0" cellspacing="1" width="100%" style="padding-bottom:20px;">
				<tr>
					<%-- 保存 --%>
					<td align="center"><a
						title="<%=PlatformLocalesJSTL
					.getBundleValue(
							"lantop.basicdatamanager.formManager.table.button.setTemplateColumnNum.button.save",
							"i18n.lantop", locale)%>" style="margin-right:20px;"
						id="saveButton" class=" easyui-linkbutton selbtnc"
						iconCls="icon-im-save" onclick="saveForm();"
						href="javascript:void(0);"><%=PlatformLocalesJSTL
					.getBundleValue(
							"lantop.basicdatamanager.formManager.table.button.setTemplateColumnNum.button.save",
							"i18n.lantop", locale)%></a> <%-- 返回 --%> <a
						title="<%=PlatformLocalesJSTL
					.getBundleValue(
							"lantop.basicdatamanager.formManager.table.button.setTemplateColumnNum.button.return",
							"i18n.lantop", locale)%>"
						id="closeButton" class="easyui-linkbutton selbtnc"
						iconCls="icon-im-back" onclick="closeForm();"
						href="javascript:void(0);"><%=PlatformLocalesJSTL
					.getBundleValue(
							"lantop.basicdatamanager.formManager.table.button.setTemplateColumnNum.button.return",
							"i18n.lantop", locale)%></a></td>
				</tr>
			</table>
		</div>
	</div>
</body>
</html>